package com.kim.nidoya.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

public class MediaCenterBaseAdapter<T> extends BaseAdapter {

	protected List<T> dataList;
	protected String[] dataArray;
	protected Context context;

	public MediaCenterBaseAdapter(Context context, List<T> dataList) {
		this.context = context;
		this.dataList = dataList;
	}

	public MediaCenterBaseAdapter(Context context, String[] dataArray) {
		this.context = context;
		this.dataArray = dataArray;
	}

	public void refreshData(List<T> dataList) {
		this.dataList = dataList;
		notifyDataSetChanged();
	}

	public void refreshData(String[] dataArray) {
		this.dataArray = dataArray;
		notifyDataSetChanged();
	}

	@Override
	public int getCount() {
		if (dataArray != null) {
			return dataArray.length;
		}
		return this.dataList.size();
	}

	@Override
	public Object getItem(int position) {
		if (dataArray != null) {
			return dataArray[position];
		}
		return this.dataList.get(position);
	}

	@Override
	public long getItemId(int position) {
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		return null;
	}

}
